﻿@inherits AdminCompontentBase
<pre class="json-pre @(Overflow?"overflow-y":"") @Class" @ref="Ref"></pre>

@code {
    [Parameter]
    public string Value { get; set; } = default!;

    [Parameter]
    public bool Overflow { get; set; }

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
            await JsonFormat();
        }
    }

    protected override async Task OnParametersSetAsync()
    {
        await JsonFormat();
    }

    private async Task JsonFormat()
    {
        await Js.InvokeVoidAsync("util.jsonFormat", Ref, Value);
    }
}
